import time


from Page.page import Page
from selenium.webdriver.common.by import By
class Page1(Page):
    input_loc = (By.CLASS_NAME, 'search-input')
    # 搜索按钮
    btn_loc = (By.CLASS_NAME, 'search-input-btn')
    # 点击商品
    shop_loc = (By.XPATH, '/html/body/div[5]/div[2]/div[2]/div[1]/ul/li[1]/div[1]/span/a/img')
    # 立即购买
    buybtn_loc = (By.ID, 'buy-cart')
    # 下一步
    next_loc = (By.ID, 'order-button')

    def input(self):
        self.find_element(self.input_loc).send_keys('测试机')

    def btn(self):
        self.find_element(self.btn_loc).click()

    def shop(self):
        self.find_element(self.shop_loc).click()

    def buybtn(self):
        self.find_element(self.buybtn_loc).click()

    def next(self):
        self.find_element(self.next_loc).click()

    def a3mall_luoji1(self):
        self.a3mall_luoji('18986670716','a123456')
        self.input()
        self.btn()
        self.shop()
        self.scroll_to_element(500)
        self.buybtn()
        self.next()